package org.springblade.modules.admin.vo.sugar.bi;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.admin.enums.MaintainPlanContentEnum;
import org.springblade.modules.admin.enums.TaskStatusEnum;

import java.io.Serializable;
import java.util.Date;

/**
 * @Date 10:17 2024/12/12
 * @Description {
 *    BI 电梯维修工单数据
 * }
 * @Author lsay
 **/
@Data
public class BIScreenElevatorPlanVO implements Serializable {

	/**
	 * 工单ID
	 */
	private Long planId;

	/**
	 * 电梯ID
	 */
	private Long elevatorId;

	/**
	 * 1-内部整改 2-客户报障
	 */
	private Integer planWorkOrderType;

	/**
	 * 1-内部整改 2-客户报障
	 */
	private String planWorkOrderTypeDesc;

	/**
	 * 评分状态 0-未评分，1-已评分
	 */
	private Integer planScoreStatus;

	/**
	 * 评分状态 0-未评分，1-已评分
	 */
	private String planScoreStatusDesc;

	/**
	 * 评分类型1:有效订单，2：无效工单3：无法判断
	 */
	private Integer planScoreType;

	/**
	 * 评分类型1:有效订单，2：无效工单3：无法判断
	 */
	private String planScoreTypeDesc;

	/**
	 * 评分时间
	 */
	private Date planScoreDate;

	/**
	 * 电梯报障状态： 1-正常,2-停梯（用于报障描述）
	 */
	private Integer planElevatorStop;

	/**
	 * 电梯报障状态： 1-正常,2-停梯（用于报障描述）
	 */
	private String planElevatorStopDesc;

	/**
	 * 工单状态 2-待开始 3-进行中 4-已完成
	 */
	private Integer planStatus;

	/**
	 * 工单状态 2-待开始 3-进行中 4-已完成
	 */
	private String planStatusDesc;

	/**
	 * 工单人员
	 */
	private String planUsers;

	/**
	 * 工单创建时间
	 */
	private Date planCreateTime;

	/**
	 * 工单到达时间
	 */
	private Date planArriveTime;

	/**
	 * 工单完成时间
	 */
	private Date planEndTime;

	public void setPlanWorkOrderType(Integer planWorkOrderType) {
		this.planWorkOrderType = planWorkOrderType;
		if(Func.isNotEmpty(planWorkOrderType)){
			this.planWorkOrderTypeDesc = planWorkOrderType == 1 ? "内部整改" : "客户报障";
		}
	}

	public void setPlanScoreStatus(Integer planScoreStatus) {
		this.planScoreStatus = planScoreStatus;
		if(Func.isNotEmpty(planScoreStatus)){
			this.planScoreStatusDesc = planScoreStatus == 1 ? "已评分" : "未评分";
		}
	}

	public void setPlanScoreType(Integer planScoreType) {
		this.planScoreType = planScoreType;
		if(Func.isNotEmpty(planScoreType)){
			if(planScoreType == 1){
				this.planScoreTypeDesc = "有效订单";
			}
			if(planScoreType == 2){
				this.planScoreTypeDesc = "无效工单";
			}
			if(planScoreType == 3){
				this.planScoreTypeDesc = "无法判断";
			}
		}
	}

	public void setPlanElevatorStop(Integer planElevatorStop) {
		this.planElevatorStop = planElevatorStop;
		if(Func.isNotEmpty(planElevatorStop)){
			this.planElevatorStopDesc = planElevatorStop == 1 ? "正常" : "停梯";
		}
	}

	public void setPlanStatus(Integer planStatus) {
		this.planStatus = planStatus;
		if(Func.isNotEmpty(planStatus)){
			this.planStatusDesc = TaskStatusEnum.getTaskName(MaintainPlanContentEnum.MAINTAIN_WX.getId(),planStatus);
		}
	}
}
